#ifndef AVLTREE_H
#define AVLTREE_H
#include <functional>
#include "BSTree.h"

typedef signed char s8;

template<typename T>
class AVLTree : public BSTree<T> {
        public :
            AVLTree () : BSTree<T>() {}
	    AVLTree (T e, u64 k = 0, AVLTree *l = NULL, AVLTree *r = NULL)
                : BSTree<T>(e,k,l,r) {}
            ~AVLTree() {}

            int insert(const T&, u64);
            s8 bal() { return _bal; }

        protected:
            int rebalance();
            s8 _bal;
            bool inc;
};


#endif /* AVLTREE_H */
